import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    //在歌手列表页和歌手详情页之间传递歌手的信息
    singer: {}
  },
  mutations: {
    saveSinger(state, singer) {
      state.singer = singer
    }
  },
  actions: {
    saveSinger(context, singer) {
      //actions提交（commit）mutations
      context.commit('saveSinger', singer)
    }
  }
})

export default store
